#ifndef _DEBUG_H_INCLUDED
#define _DEBUG_H_INCLUDED

#include "rs.h"
#include "fcheat_stdio.h"


extern fcheat_file fileRS;// = FCHEAT_STATIC_FDEVOPENWR(rs_putc,rs_getc);
extern FILE * fRS;// = (FILE*)&fileRS;

#define BLACK "\033[0;30m"
#define RED 		"\033[0;31m"
#define GREEN 		"\033[0;32m"
#define YELLOW 		"\033[0;33m"
#define BLUE 		"\033[0;34m"
#define MAGENTA		"\033[0;35m"
#define CYAN 		"\033[0;36m"
#define WHITE  "\033[0;37m"

#define BOLD_BLACK "\033[1;30m"
#define BOLD_RED 		"\033[1;31m"
#define BOLD_GREEN 		"\033[1;32m"
#define BOLD_YELLOW 		"\033[1;33m"
#define BOLD_MAGENTA		"\033[1;35m"
#define BOLD_CYAN 		"\033[1;36m"
#define BOLD_BLUE 		"\033[1;34m"
#define BOLD_WHITE  "\033[1;37m"

#define UNDERLINE_BLACK "\033[4;30m"
#define UNDERLINE_RED 		"\033[4;31m"
#define UNDERLINE_GREEN 		"\033[4;32m"
#define UNDERLINE_YELLOW 		"\033[4;33m"
#define UNDERLINE_MAGENTA		"\033[4;35m"
#define UNDERLINE_CYAN 		"\033[4;36m"
#define UNDERLINE_BLUE 		"\033[4;34m"
#define UNDERLINE_WHITE  "\033[4;37m"

#define INTENSIVE_BLACK "\033[0;90m"
#define INTENSIVE_RED 		"\033[0;91m"
#define INTENSIVE_GREEN 		"\033[0;92m"
#define INTENSIVE_YELLOW 		"\033[0;93m"
#define INTENSIVE_MAGENTA		"\033[0;95m"
#define INTENSIVE_CYAN 		"\033[0;96m"
#define INTENSIVE_BLUE 		"\033[0;94m"
#define INTENSIVE_WHITE  "\033[0;97m"

#define BOLD_INTENSIVE_BLACK "\033[1;90m"
#define BOLD_INTENSIVE_RED 		"\033[1;91m"
#define BOLD_INTENSIVE_GREEN 		"\033[1;92m"
#define BOLD_INTENSIVE_YELLOW 		"\033[1;93m"
#define BOLD_INTENSIVE_BLUE 		"\033[1;94m"
#define BOLD_INTENSIVE_MAGENTA		"\033[1;95m"
#define BOLD_INTENSIVE_CYAN 		"\033[1;96m"
#define BOLD_INTENSIVE_WHITE  "\033[1;97m"

#define BCKGND_BLACK "\033[40m"
#define BCKGND_RED 		"\033[41m"
#define BCKGND_GREEN 		"\033[42m"
#define BCKGND_YELLOW 		"\033[43m"
#define BCKGND_BLUE 		"\033[44m"
#define BCKGND_MAGENTA		"\033[45m"
#define BCKGND_CYAN 		"\033[46m"
#define BCKGND_WHITE  "\033[47m"

#define ENDCOLOR 	"\033[0m"

#define DEBUG_FH  fRS


#define DEBUG_INIT() rs_init()

#ifdef DEBUG_MODE
  #define DEBUG(x)		(x)
  #define DEBUG_PRINT(fmt,args...)	fprintf_P((DEBUG_FH),PSTR(fmt),## args)
  #define DEBUG_PRINT_COLOR(c,fmt,args...)  fprintf_P((DEBUG_FH),PSTR((c) (fmt) ENDCOLOR),## args)
  #define DEBUG_SET_COLOR(c)	{fprintf_P((DEBUG_FH),PSTR((c)));}
  #define DEBUG_CLR_COLOR()	{fprintf_P((DEBUG_FH),PSTR((ENDCOLOR)));} 
#else
  #define DEBUG(x)
  #define DEBUG_PRINT(fmt,args...) 
  #define DEBUG_PRINT_COLOR(c,fmt,args...)
  #define DEBUG_SET_COLOR(c) 
  #define DEBUG_CLR_COLOR() 
#endif





#endif //_DEBUG_H_INCLUDED